import { FormType } from '@/base-ui/base-form/type'
import { ActionDesc } from '@/global/constant'
import { IModalConfig } from '@/components/page-modal/type'

const modalSecondAuth: IModalConfig = {
  modalProps: {
    title: '二次认证',
    closable: false,
    maskClosable: false,
    keyboard: false,
    width: 380
  },
  formProps: {
    desc: ActionDesc.SecondAuth,
    layout: { span: 24 },
    formConfig: {
      name: 'second-auth',
      // layout: 'inline',
      // 禁止整个表单操作
      // disabled: true,
      initialValues: {
        type: 0
      },
      size: 'middle',
      labelAlign: 'right',
      // labelCol: 输入框这些前面的文字的宽度
      labelCol: { flex: '80px' },
      // labelWrap：表单前面的label宽度(labelCol指定的flex)不够,那么他会进行自动换行
      // labelWrap: true,
      // wrapperCol: { span: 12 },
      colon: false
      // style: { minWidth: 500 }
    },
    itemsConfig: [
      {
        type: FormType.Select,
        prop: 'type',
        name: 'type',
        label: '验证方式',
        select: {
          baseProps: {
            size: 'small',
            placement: 'bottomLeft'
          },
          options: [
            { value: 0, content: '密码' },
            { value: 1, content: '手机号' },
            { value: 2, content: '邮箱' }
          ]
        }
      },
      {
        type: FormType.Password,
        prop: 'password', //必写的，唯一标识,因为name属性不一定全部都会有
        name: 'password',
        label: '密码',
        rules: [{ required: true }],
        input: {
          placeholder: '请输入密码'
        }
      },
      {
        type: FormType.Input,
        prop: 'userPhone',
        name: 'userPhone',
        label: '手机号',
        input: {
          allowClear: true,
          placeholder: '请输入手机号'
        }
      },
      {
        type: FormType.Input,
        prop: 'email',
        name: 'email',
        label: '邮箱',
        input: {
          allowClear: true,
          placeholder: '请输入邮箱'
        }
      },
      {
        type: FormType.Custom,
        customkey: 'code',
        name: 'code',
        prop: 'code',
        label: '验证码'
      }
    ]
  }
}

export default modalSecondAuth
